/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * welcome.java
 *
 * Created on 26/01/2010, 19:44:35
 */

package cparc;

import com.mysql.jdbc.Statement;
import java.sql.ResultSet;

/**
 *
 * @author Administrador
 */
public class welcome extends javax.swing.JInternalFrame {

    /** Creates new form welcome */
    public welcome() {
        initComponents();
        

        Statement stm = null;
        String result = null;

        String sqlProp = "SELECT COUNT(PCOD) AS CONT FROM CPARC.CAD_PROP";
        String sqlBai = "SELECT COUNT(BCOD) AS CONT FROM CPARC.CAD_BAI";
        String sqlRua = "SELECT COUNT(RCOD) AS CONT FROM CPARC.CAD_RUAS";
        String sqlRaca = "SELECT COUNT(RCOD) AS CONT FROM CPARC.CAD_RACAS";
        String sqlAnimTot = "SELECT COUNT(ACOD) AS CONT FROM CPARC.CAD_ANIM";
        String sqlFelinTot = "SELECT COUNT(ACOD) AS CONT FROM CPARC.CAD_ANIM WHERE AESP = 2";
        String sqlFelinMacho = "SELECT COUNT(ACOD) AS CONT FROM CPARC.CAD_ANIM WHERE AESP = 2 AND ASEX = 2";
        String sqlFelinFem = "SELECT COUNT(ACOD) AS CONT FROM CPARC.CAD_ANIM WHERE AESP = 2 AND ASEX = 1";
        String sqlCanTot = "SELECT COUNT(ACOD) AS CONT FROM CPARC.CAD_ANIM WHERE AESP = 1";
        String sqlCanMacho = "SELECT COUNT(ACOD) AS CONT FROM CPARC.CAD_ANIM WHERE AESP = 1 AND ASEX = 2";
        String sqlCanFem = "SELECT COUNT(ACOD) AS CONT FROM CPARC.CAD_ANIM WHERE AESP = 1 AND ASEX = 1";


        try  {
        stm = (Statement) conexao.getConnection(true).createStatement();
        ResultSet rs = stm.executeQuery(sqlProp);
        rs.next();
        prop.setText(prop.getText() + String.valueOf(rs.getInt("CONT")));
        

            rs = stm.executeQuery(sqlBai);
            rs.next();
            bai.setText(bai.getText() + rs.getString("CONT"));

            rs = stm.executeQuery(sqlRua);
            rs.next();
            ruas.setText(ruas.getText() + rs.getString("CONT"));

            rs = stm.executeQuery(sqlRaca);
            rs.next();
            racas.setText(racas.getText() + rs.getString("CONT"));

            rs = stm.executeQuery(sqlAnimTot);
            rs.next();
            animTot.setText(animTot.getText() + rs.getString("CONT"));

            rs = stm.executeQuery(sqlFelinTot);
            rs.next();
            felTot.setText(felTot.getText() + rs.getString("CONT"));

            rs = stm.executeQuery(sqlFelinFem);
            rs.next();
            felFem.setText(felFem.getText() + rs.getString("CONT"));

            rs = stm.executeQuery(sqlFelinMacho);
            rs.next();
            felMacho.setText(felMacho.getText() + rs.getString("CONT"));

            rs = stm.executeQuery(sqlCanTot);
            rs.next();
            canTot.setText(canTot.getText() + rs.getString("CONT"));

            rs = stm.executeQuery(sqlCanFem);
            rs.next();
            canFem.setText(canFem.getText() + rs.getString("CONT"));

            rs = stm.executeQuery(sqlCanMacho);
            rs.next();
            canMacho.setText(canMacho.getText() + rs.getString("CONT"));
        }
        catch(Exception e){
            String status = e.getMessage();
            System.out.println(status);
        }

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jCalendar1 = new com.toedter.calendar.JCalendar();
        jLabel1 = new javax.swing.JLabel();
        animTot = new javax.swing.JLabel();
        prop = new javax.swing.JLabel();
        bai = new javax.swing.JLabel();
        ruas = new javax.swing.JLabel();
        racas = new javax.swing.JLabel();
        felTot = new javax.swing.JLabel();
        felMacho = new javax.swing.JLabel();
        felFem = new javax.swing.JLabel();
        canTot = new javax.swing.JLabel();
        canMacho = new javax.swing.JLabel();
        canFem = new javax.swing.JLabel();

        setClosable(true);
        setTitle("Bem-Vindo!");

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
        jLabel1.setText("Sistema de Vacinação");

        animTot.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        animTot.setText("Animais Cadastrados: ");

        prop.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        prop.setText("Proprietários Cadastrados: ");

        bai.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        bai.setText("Bairros Cadastrados: ");

        ruas.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        ruas.setText("Ruas Cadastradas: ");

        racas.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        racas.setText("Raças Cadastradas: ");

        felTot.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        felTot.setText("Total de Felinos: ");

        felMacho.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        felMacho.setText("Total de Felinos Machos: ");

        felFem.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        felFem.setText("Total de Felinos Fêmeas: ");

        canTot.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        canTot.setText("Total de Caninos: ");

        canMacho.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        canMacho.setText("Total de Caninos Machos: ");

        canFem.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        canFem.setText("Total de Caninos Fêmeas: ");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(29, 29, 29)
                        .addComponent(jLabel1))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(animTot)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 36, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(felFem)
                                .addComponent(felMacho)
                                .addComponent(felTot)
                                .addComponent(racas)
                                .addComponent(ruas)
                                .addComponent(prop)
                                .addComponent(bai)))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 53, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(canFem)
                            .addComponent(canMacho)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(canTot)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 56, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(88, 88, 88))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jCalendar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(68, 68, 68))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addGap(18, 18, 18)
                        .addComponent(prop)
                        .addGap(18, 18, 18)
                        .addComponent(bai)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(ruas)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(racas)
                        .addGap(6, 6, 6)
                        .addComponent(animTot)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(felTot)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(felMacho)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(felFem))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jCalendar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(34, 34, 34)
                        .addComponent(canTot)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(canMacho)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(canFem)))
                .addContainerGap(30, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel animTot;
    private javax.swing.JLabel bai;
    private javax.swing.JLabel canFem;
    private javax.swing.JLabel canMacho;
    private javax.swing.JLabel canTot;
    private javax.swing.JLabel felFem;
    private javax.swing.JLabel felMacho;
    private javax.swing.JLabel felTot;
    private com.toedter.calendar.JCalendar jCalendar1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel prop;
    private javax.swing.JLabel racas;
    private javax.swing.JLabel ruas;
    // End of variables declaration//GEN-END:variables

}
